﻿@model FashionShop.Models.Product

@{
    ViewBag.Title = "Edit product";
}

<h2>Edit</h2>

@using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" })){
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Product</legend>

        @Html.HiddenFor(model => model.ProductID)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>



        <div class="editor-label">
            @Html.LabelFor(model => model.Price)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Price)
            @Html.ValidationMessageFor(model => model.Price)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SalePrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SalePrice)
            @Html.ValidationMessageFor(model => model.SalePrice)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Status)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Status)
            @Html.ValidationMessageFor(model => model.Status)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.BrandID, "Brand")
        </div>
        <div class="editor-field">
            @Html.DropDownList("BrandID", "Chọn thương hiệu")
            @Html.ValidationMessageFor(model => model.BrandID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ProductCatalogueID, "ProductCatalogue")
        </div>
        <div class="editor-field">
            @Html.DropDownList("ProductCatalogueID", "Chọn mục")
            @Html.ValidationMessageFor(model => model.ProductCatalogueID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LocationID, "LocationID")
        </div>
        <div class="editor-field">
            @Html.DropDownList("LocationID", "Chọn quốc gia")
            @Html.ValidationMessageFor(model => model.LocationID)
        </div>

         <div class="editor-label hide">
            @Html.LabelFor(model => model.Created)
        </div>
        <div class="editor-field hide">
            @Html.EditorFor(model => model.Created)
            @Html.ValidationMessageFor(model => model.Created)
        </div>
        <label for="Image">Image:</label>
	    <input required type="file" name="Image" id="Image" data-preview-img="#product-img" data-allow-types="image/jpg,image/jpeg,image/png" data-max-size="1048576" />
        @{var ImageURL = "/Content/img/product/" + Model.ProductID + ".jpg";}
        <img id="product-img" src="@ImageURL"  height="120" width="160"/>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
